@extends('admin.container')

@section('c-head')
    <script type="text/javascript">
        var PAGE_DATA = {
            // DEFAULT : null, // 新增.

            // 编辑
            @if(isset($brand))
            DEFAULT : {
                name : "{{ $brand->name }}", //品牌名称
                file_url : "{{ $brand->logo }}",
                file_name : "{{ pathinfo($brand->logo, PATHINFO_BASENAME) }}",
                recommend : "{{ $brand->recommend }}", //是否推荐, 是: 1, 否: 0;
                sort : "{{ $brand->sort }}",  //排序,0~255，数字越小越靠前。
                category_id : "200001" //分类名称, 200001-咖啡物料
            },
            @else
            DEFAULT : null,
            @endif
            REST_API : {
                category_url : '{{route('goods.primary-category.first.category')}}',
                uploadimg : '/temp/image',
                preViewImg : 'temp',
            }
        };
    </script>
@stop

@section('c-body')
    <div class="comm-title">
                    <span id="page-nav" class="title-msg">
                        <!-- 品牌管理 -->
                    </span>
    </div>
    <div class="comm-body">
        <form id="main-form" style="margin-top: 20px;" action="{{ $form }}"  method="post" enctype="multipart/form-data">
            <input type="hidden" value="{{ csrf_token() }}" name="_token">
            @if(isset($brand))<input type="hidden" name="_method" value="PUT">@endif
            <div class="input-line">
                <div class="key-txt">
                    品牌名称:
                </div>
                <div class="right-val">
                    <input id="brandName" name="name" style="width:100%;" />
                </div>
            </div>
            <div class="input-line">
                <div class="key-txt">
                    所属分类:
                </div>
                <div class="right-val">
                    <select id="category_id" name="category_id" style="width:100%;">

                    </select>
                </div>
                        <span class="tips-comm">
                            选择分类，可关联大分类或更具体的下级分类。（只在后台快捷定位中起作用）
                        </span>
            </div>
            <div class="input-line">
                <div class="key-txt">
                    图片标识:
                </div>
                <div class="right-val">
                    <input id="file_name" name="file_name" style="width:100%;" readonly />
                </div>
                <button type="button" class="am-btn am-btn-primary am-btn-xs" id="sel-pic" style="margin-left:10px; margin-top: 3px;float: left;">
                    浏览
                </button>

                <input type="file" id="logo" name="logo" style="display:none;" />

                        <span class="tips-comm">
                            品牌LOGO尺寸要求宽度为180像素，高度为80像素，支持gif，jpg，png格式。
                        </span>
            </div>

            <div id="preview" class="input-line" style="height:80px; display:none;">
                <div class="key-txt">
                    <span style="visibility:hidden">预览图片</span>
                </div>
                <div class="right-val">
                    <img id="file_url" src="" style="width:180px; height:80px; background-color:#dddddd;">
                </div>
            </div>

            <div class="input-line">
                <div class="key-txt">
                    是否推荐:
                </div>
                <div class="right-val">
                    <div id="sel-recommed" class="am-btn-group">
                        <button type="button" class="am-btn am-btn-default am-btn-sm" data-sts="1">
                                    <span style="display:block;">
                                        是
                                    </span>
                        </button>
                        <button type="button" class="am-btn am-btn-default am-btn-sm" data-sts="0">
                                    <span style="display:block;">
                                        否
                                    </span>
                        </button>
                    </div>
                    <input type="hidden" id="recommend" name="recommend" value="0" />
                </div>
                        <span class="tips-comm">
                            选择被推荐的品牌将在所有品牌列表页“推荐品牌”位置展现。
                        </span>
            </div>
            <div class="input-line">
                <div class="key-txt">
                    排序:
                </div>
                <div class="right-val">
                    <input id="sort" name="sort" style="width:100%;" />
                </div>
                        <span class="tips-comm">
                            数字范围为0~255，数字越小越靠前。
                        </span>
            </div>
            <div class="input-line" style="height:40px;margin-top: 30px;">
                <div class="key-txt">
                </div>
                <div class="right-val">
                    <button id="submit-btn" class="am-btn am-btn-primary am-btn-lg">
                                <span style="display:block;">
                                    提交
                                </span>
                    </button>
                    <button id="cancel-btn" type="button" class="am-btn am-btn-default am-btn-lg">
                                <span style="display:block;">
                                    取消
                                </span>
                    </button>
                </div>
            </div>

        </form>

    </div>
    <script src="/assets/b2b/admin/js/libs/jquery.ajaxfileupload.js"> </script>
    <script src="/assets/b2b/admin/js/pages/06.js"></script>
@stop

